﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class admin_msgShow : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            getInfo();
        }
    }
    //获取值
    void getInfo()
    {
        if (Request["id"] != null && Request["id"].ToString().Trim().Length > 0)
        {
            //获取此数据
            OleDbConnection conn = DB.conn();
            if (conn != null)
            {
                conn.Open();
                OleDbCommand comm = null;
                try
                {
                    comm = new OleDbCommand();
                    comm.Connection = conn;
                    comm.CommandText = "select * from msg where id=" + Request["id"].ToString().Trim();
                    OleDbDataReader dr = comm.ExecuteReader();
                    if (dr != null && dr.HasRows)
                    {
                        dr.Read();
                        name.Text = dr["name"].ToString();
                        this.tel.Text = dr["tel"].ToString();
                        this.email.Text = dr["email"].ToString();
                        this.address.Text = dr["address"].ToString();
                        this.postcode.Text = dr["postcode"].ToString();
                        this.content.Text = dr["content"].ToString();
                        this.adddate.Text = dr["adddate"].ToString();
                    }
                }
                catch (Exception error)
                {
                    Response.Write(error.ToString());
                }
                finally
                {
                    if (comm != null)
                        comm.Dispose();
                    conn.Close();
                }
            }
        }
    }
}
